﻿<!DOCTYPE html>
<html lang="en" class="no-js">

	<head lang="en">
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>一元购</title>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="css/style.css">
		<link rel="stylesheet" type="text/css" href="css/style_login.css" />
		<link rel="stylesheet" type="text/css" href="css/style_p2p.css">
		<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" href="css/demo.css" media="all" />
		<link rel="stylesheet" href="css/lanrenzhijia.css" media="all">
		<link rel="stylesheet" href="css/animate.min.css" />

	</head>

	<body>
		<div class="zxcf_top_wper">
			<div class="zxcf_top px1000 clearfix">
				<div class="zxcf_top_l fl">
					<img src="images/zxcf_phone.png" alt=""> 400-027-0101(工作时间9:00-17:30)
					<a href="#"><img src="images/zxcf_weixin.png" alt=""></a>
					<a href="#"><img src="images/zxcf_sina.png" alt=""></a>
					<a href="#"><img src="images/zxcf_qq.png" alt=""></a>
				</div>
				<div class="zxcf_top_r fr">
					<a href="#" id="login_li" class="curspan cd-signin">立即登录</a>
					<a href="#" id="username_li" class="curspan" style="display:none">用户名</a>
					<span>|</span>
					<a href="#" id="loginout" style="display:none">[退出]</a>
					<a href="#" id="register_li" class="cd-signup">免费注册</a>
					<span>|</span>
					<a href="#">常见问题</a>
				</div>
			</div>
		</div>
		<!-- end top -->
		<div class="zxcf_nav_wper">
			<div class="zxcf_nav clearfix px1000">
				<div class="zxcf_nav_l fl"><img src="images/indexicon.png" alt=""></div>
				<div class="zxcf_nav_l fr" style="margin-top:10px">
					<img id="touxiangicon" style="width: 32px;" >
					<span>我的账户</span>
				</div>
			</div>
		</div>
		<div class="zxcf_menu_wper">
			<div class="zxcf_menu px1000">
				<a href="index.html">首页</a>
				<a href="#">优选商品</a>
				<a href="#">最新揭晓</a>
				<a href="#">晒单分享</a>
				<a href="viewlist.html" class="zm_cura">查看中奖</a>
				<a href="personal.html" style="margin-right:0;">个人中心</a>
			</div>
		</div>

		<div class="container" style="background-color:#ffffff">
			<header>
				<div id="fdw-pricing-table">
				<!--	<div class="plan plan4">
						<div class="header">商品名称+活动Id</div>
						<div class="price">$100</div>
						<div class="monthly">总共多少份</div>
						<ul>
							<li><b>收货地址</b> Disk Space</li>
                        <li><b>身份证号</b> Monthly Bandwidth</li>
                        <li><b>手机号码</b> Email Accounts</li>
							<li><b>状态</b> 未发货</li>
						</ul>
						<a id="shouhuo" class="signup" href="javascript:;">收货信息</a>
						<a id="chakan" class="signup" href="javascript:;">查看购买</a>
					</div>-->
				</div>
			</header>
		<!--	<div style="text-align: center;font-size:20px">
				<a id="morelist">查看更多</a>
			</div>-->
			<footer id="footer" role="contentinfo">
				<div class="container">
					<div class="row row-bottom-padded-sm">
						<div class="col-md-12">
							<p class="copyright text-center">Copyright &copy; 2016.Company name All rights reserved.</p>
						</div>
					</div>
				</div>
			</footer>
		</div>

		<div class="theme-popover" id="shouhuoxinxi">
			<div class="theme-poptit">
				<a href="javascript:;" title="关闭" class="close">×</a>
				<h3>提交收货信息</h3>
			</div>
			<div class="theme-popbod dform">
				<form class="theme-signin" name="loginform" action="" method="post">
					<ol>
						<li>
							<h4></h4></li>
						<li><strong>收货地址：</strong><input id="address" class="ipt" type="text" name="log" size="40" /></li>
						<li><strong>身份证号：</strong><input id="numid" class="ipt" type="text" name="pwd" size="20" /></li>
						<li><strong>手机号码：</strong><input id="phone" class="ipt" type="text" name="pwd" size="20" /></li>
						<li><input id="winning" class="btn btn-primary" type="button" name="submit" value=" 提交 " /></li>
					</ol>
				</form>
			</div>
		</div>
		<div class="theme-popover" id="zhongjiang">
			<div class="theme-poptit">
				<a href="javascript:;" title="关闭" class="close">×</a>
				<h3>购买记录</h3>
			</div>
			<div id="buycode" style="overflow-y: scroll; OVERFLOW-X: hidden; text-align: left; height: 250px; width: 548px; display: block; word-break: break-all; word-wrap: break-word;">

			</div>
		</div>

	</body>
	<script type="text/javascript" src="js/dialog.js"></script>
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/all.js"></script>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/main.js"></script>
	<script type="text/javascript" src="js/login.js"></script>
	<script type="text/javascript" src="js/jquery.hDialog.min.js"></script>
	<script>
        $(document).ready(function ($) {
            var listid;
            //弹窗
            showshouhuo=function(o)  {
                
                    //    $('.theme-popover-mask').fadeIn(100);
                    $('#shouhuoxinxi').slideDown(200);
                    listid = o.title;
               
            }

            showbuy = function (o) {
               
                    //    $('.theme-popover-mask').fadeIn(100);		
                listid = o.title;
                    $.ajax({
                        type: 'POST',
                        url: "Pages/handle/getIsWin.ashx",
                        data: {
                            "listId": listid
                        },
                        success: function (data) {
                            console.log(data);
                            if (data == 207) {
                                $.tooltip('无购买记录');
                            } else {
                                $('#zhongjiang').slideDown(200);
                                var str = "";
                                for (var key in data) {
                                    str += "<p style='font-size:14px;'>购买时间:" + data[key]['buyTime'] + "  幸运号:" + data[key]['code'] + "  状态:" + data[key]['status'] + "</p>";
                                }
                                $('#buycode').html(str);
                            }
                        },
                        error: function () {
                            $.tooltip('请求异常');
                        },
                        dataType: "json"
                    });
                
            }
            

            $('.theme-poptit .close').click(function () {
                $('.theme-popover-mask').fadeOut(100);
                $('.theme-popover').slideUp(200);
            });

            $('#winning').click(function () {
                var address = $('#address').val();
                var numid = $('#numid').val();
                var phone = $('#phone').val();
                if (address == "") {
                    $.tooltip('地址不能为空');
                    return false;
                }
                if (numid == "") {
                    $.tooltip('身份证号不能为空');
                    return false;
                }
                if (phone == "") {
                    $.tooltip('手机号不能为空');
                    return false;
                }
                $.ajax({
                    type: 'POST',
                    url: "Pages/handle/winningInformationFill.ashx",
                    data: {
                        "Address": address,
                        "IdNumber": numid,
                        "Phone": phone,
                        "listId": listid
                    },
                    success: function (data) {
                        if (data == null) {
                            $.tooltip('服务器异常');
                        } else {
                            var result = data;
                            if (result == 208) {
                                $.tooltip('收货信息填写成功', 2000, true);
                            } else {
                                $.tooltip('收货信息填写失败');
                            }
                        }

                    },
                    error: function () {
                        $.tooltip('请求异常');
                    },
                    dataType: "json"
                });
            });
        });
		var pages = 1;
		getmore = function() {
			//获取列表接口  用户id  根据页数
			//返回 活动名称  总共多少份  活动id  获奖人  幸运号码  揭晓时间   本期参与 我的号码  按活动时间倒叙  
			$.ajax({
				type: 'POST',
				url: "Pages/handle/getPurchaseHistory.ashx",
				data: {
					"pageIndex": pages
				},
				success: function(data) {
					var result=data;
					if(data == null) {
						$.tooltip('服务器异常');
					} else {
					    if (result != 207) {
					        for (var key in data) {
								var str = "";
								str += " <div class='plan plan4'style='margin-bottom:20px;'>";
								str += "  <div class='header'>第" + data[key]['listId'] + "期" + data[key]['goodsName'] + "</div>";
								str += "  <div class='price'>花费" + data[key]['buyNum'] + "</div>";
								str += "  <div class='monthly'>总需" + data[key]['aNum'] + "人/次</div>"
								str += "   <ul>"
								str += "       <li><b>状态</b> " + data[key]['status'] + "</li>"
								str += "   </ul>";
								if(data[key]['status'] == "中奖")
								    str += "<a id='shouhuo' class='signup' title='" + data[key]['listId'] + "' href='#' onclick='showshouhuo(this);'>收货信息</a>";
								str += "<a id='chakan' class='signup1' title='" + data[key]['listId'] + "' href='#' onclick='showbuy(this);'>查看购买</a>";
								str += " </div>";
								$('#fdw-pricing-table').append(str);
							}
							pages++;
						} else {
							$.tooltip('获取失败');
						}
					}

				},
				error: function() {
					$.tooltip('服务器异常');
				},
				dataType: "json"
			});
		}
		getmore();
	/*	$('#morelist').click(function () {
		    getmore();
		});*/
	</script>

</html>